<?php
class class_login
{
	//Khai bao bien
	var $arr_login;//luu tat ca gia tri tim kiem vao array
	var $arr_cat_all;
	var $arr_catcontent_all;
	
	function class_login()	
	{
		global $arr_menu_id, $langid;
		//Khoi tao bien
		//$bien = 0;
		$arr_login = array();
		$arr_cat_all = array();
		$arr_catcontent_all = array();

	}
	//thay the gia tri nhu submit file, button...
	function loadtemplate($arr)
	{
		$html = "";
		$html = loadHtml($arr["layout_html"],"");
		if (count($arr) > 0){
			foreach ($arr as $key=>$value){
				//$$key = $value;	//gan gia tri vao bien
				$pattern = "@$key@";
				$replacement = "$value";
				$html = ereg_replace($pattern, $replacement, $html);
			}//end for
		}
		return $html;	
	}


	function FormLogin()
	{
		$html = loadHtml("../htmls_templates/tmp_login_form.htm","");
		return $html;
	}
	
	function check_username($username)
	{
		global $dbconn;
		$arr = array();
		$sql = "select * from users where username = '$username'";
		//echo "$sql<br>"; 
		$rs = new db_query($dbconn,$sql);
		if ($rs->getrow()){
			$arr = $rs->row;
		}
		//print_r ($arr);
		return $arr;

	}
	
	

}//end class_login
?>